/**
 * @file        main.cpp
 * @brief       gtdshell entry point.
 *
 * @author      Emre Turkay <emreturkay at gmail>
 * @date        May.30.2008
 *
 * Copyright Emre Turkay 2009
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file COPYRIGHT or copy at
 * http://www.boost.org/LICENSE_1_0.txt)
 */

#include "configuration.hpp"
#include "application.hpp"
#include "interface.hpp"
#include "gtd.hpp"

#include <cstdlib>

/// Application entry point.
int main()
{
    try
    {
        gtd::configuration conf;

        gtd::gtd backend;
        interface intf;
        application app(intf, backend, conf);

        backend.load_todo(conf.todo_file());
        backend.load_done(conf.done_file());
        app.run();
        backend.save_todo(conf.todo_file(), conf.backup_file());
        backend.save_done(conf.done_file());
    }
    catch (std::exception& e)
    {
        std::cerr << "Exception occurred: " << e.what() << std::endl;
        throw;
    }
}
